public class Code {

    public static void hanoi(int n, char source, char auxiliary, char destination) {
        if (n == 1) {
            System.out.print(source + "->" + destination + " ");

        } else {
            hanoi(n - 1, source, destination, auxiliary);
            System.out.print(source + "->" + destination + " ");
            hanoi(n - 1, auxiliary, source, destination);
        }
    }
    public static void main(String[] args) {
        hanoi(3,'A','B','C');
    }
}

